package com.candy.service.impl;

import com.candy.bean.UserInfo;
import com.candy.dao.UserInfoMapper;
import com.candy.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {
//    将持久层注入
    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public boolean login(UserInfo userInfo) {
//        调用持久层
        List<UserInfo> lu= userInfoMapper.login(userInfo);
//        若用户名密码匹配，则集合中有数据
        if(lu!=null && lu.size()>0){
//            返回true
            return true;
        }else {
//            若不匹配，返回false
            return false;
        }
    }
}
